<?php

$connexio = new mysqli("localhost", "root", "root", "calendaridaw2");

if($connexio->connect_errno > 0) die("Error en la connexio de la BBDD [".$connexio->connect_error."]");

$mail = $_POST['mail'];
$rows_resposta = array();
//$conn_result = $connexio->query("SELECT mail  FROM usuari");

$i = 0;
foreach($connexio->query("SELECT mail FROM usuari WHERE mail NOT IN('".$mail."')") as $row ) {
    if($row['mail'] != "admin@gmail.com") {
        $rows_resposta[$i] = $row['mail'];  
        //print $rows_resposta[$i];
        $i++;
    }
}

echo json_encode($rows_resposta);
$connexio->close();
        
?>